﻿<!--Modal  alert -->
@model SMECustomerWebsite.Models.ViewModels.Home.HomeViewModel
<div class="modal fade sme-popup-alert" tabindex="-1" role="dialog" aria-hidden="true" id="popup_alert">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">×</span>
                </button>
                <h2 class="modal-title" id="myModalLabel" style="text-align:center;">@SMECustomerWebsite.Core.Resources.Resource.CustAlert</h2>
            </div>
            <div class="modal-body">
                @Html.Action("PopUpAlert", "System")
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>
<!-- /modals -->


<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12" id="dashboard-home">
        @if (Model.CurrentUser.GroupIdentifier != "5" && Model.CurrentUser.GroupIdentifier != "0")
        {
            <iframe style="width:100%" id="biReportInfo" height="600" src="https://app.powerbi.com/view?r=eyJrIjoiNWRkYzFkNGQtNTE5MC00YmE3LTg4MjAtZTE3YmQ5MTQ2NWE1IiwidCI6ImZlMjI1ZWI1LTZmMzYtNDA0Ni1iYTQ3LTkyMmViNGM1YjRkZSIsImMiOjEwfQ%3D%3D" frameborder="0" allowfullscreen="true"></iframe>
        }
    </div>
</div>

@section scripts
{
    @if (Model.CurrentUser.GroupIdentifier != "5" && Model.CurrentUser.GroupIdentifier != "0")
    {
        <script type="text/javascript">
            $(document).ready(function () {
                var x = readCookie('popupAlert');
                //if (x == null) {
                    $('#popup_alert').modal('show');
                //}
                var currentDate = new Date();
                expirationDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() + 1, 0, 0, 0);
                document.cookie = "popupAlert=y; expires=" + expirationDate + "; path=/";
            });

            equalheight = function (container) {

                var currentTallest = 0,
                     currentRowStart = 0,
                     rowDivs = new Array(),
                     $el,
                     topPosition = 0;
                $(container).each(function () {

                    $el = $(this);
                    $($el).height('auto')
                    topPostion = $el.position().top;

                    if (currentRowStart != topPostion) {
                        for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
                            rowDivs[currentDiv].height(currentTallest);
                        }
                        rowDivs.length = 0; // empty the array
                        currentRowStart = topPostion;
                        currentTallest = $el.height();
                        rowDivs.push($el);
                    } else {
                        rowDivs.push($el);
                        currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
                    }
                    for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
                        rowDivs[currentDiv].height(currentTallest);
                    }
                });
            }

            $(window).load(function () {
                //equalheight('.tile-stats');
            });
        </script>
    }

    @if (true)
    {
        <script type="text/javascript">
            function startPageTourGuide() {
                var intro = introJs();
                var steps = [
                        {
                            element: '#dashboard-home',
                            intro: "@SMECustomerWebsite.Core.Resources.Resource.TourGuideHomeDashboard"
                        }
                ];
                intro.setOptions({
                    steps: steps,
                    showProgress: true,
                    scrollToElement: true,
                });
                intro.setOption('tooltipPosition', 'auto');
                intro.setOption('positionPrecedence', ['left', 'right', 'bottom', 'top'])
                intro.start();
            }
        </script>
    }
}